package com.neustudy.content.api;

import com.neustudy.base.exception.ValidationGroups;
import com.neustudy.base.model.PageParams;
import com.neustudy.base.model.PageResult;
import com.neustudy.content.model.dto.QueryCourseParamsDto;
import com.neustudy.content.model.po.CourseBase;
import com.neustudy.content.model.po.CourseTeacher;
import com.neustudy.content.service.CourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author WKX
 * @version 1.0
 * @describe todo
 * @create: 2024-11-11 17:00
 */
@Api(value = "课程老师接口",tags = "课程老师管理接口")
@RestController
public class CourseTeacherController {

    @Autowired
    CourseTeacherService courseTeacherService;

    @ApiOperation(value = "课程教师页面查询接口")
    @GetMapping("/courseTeacher/list/{courseId}")
    public List<CourseTeacher> list(@PathVariable Long courseId){

        return courseTeacherService.queryCourseTeacherList(courseId);
    }

    @ApiOperation(value = "课程教师页面新增接口")
    @PostMapping("/courseTeacher")
    public CourseTeacher courseTeacher(@Validated({ValidationGroups.Inster.class}) @RequestBody CourseTeacher courseTeacher){

        return courseTeacherService.createCourseTeacher(courseTeacher);
    }

    @ApiOperation(value = "课程教师页面修改接口")
    @PutMapping("/courseTeacher")
    public CourseTeacher updateCourseTeacher(@Validated({ValidationGroups.Update.class}) @RequestBody CourseTeacher courseTeacher){

        return courseTeacherService.updateCourseTeacher(courseTeacher);
    }

    @ApiOperation(value = "课程教师页面删除接口")
    @DeleteMapping ("/courseTeacher/course/{courseId}/{teacherId}")
    public void updateCourseTeacher(@PathVariable("courseId") Long courseId ,@PathVariable("teacherId") Long teacherId ){

        courseTeacherService.deletCourseTeacher(courseId,teacherId);
    }

}
